#pragma once
#include "XmlNode.h"

class CXml
{
public:
    CXml(void);
    ~CXml(void);
    
protected:
    MSXML2::IXMLDOMDocument2Ptr m_pDoc; 
    CString      m_strFilePath;
    
public:
    // open Xml file
	BOOL Open(CString strXmlFilePath, bool bCreate=true );
    
    // save Xml file
    BOOL Save(LPCTSTR lpszFilePath = NULL);
    
    // close Xml file
    void Close(void);

    CString GetLastError(void);
    
    // get root
    CXmlNodePtr GetRoot(void);  
    
    CXmlNodePtr SelectSingleNode(LPCTSTR lpszPath);
    
    CXmlNodesPtr SelectNodes(LPCTSTR lpszPath);
    
    static BOOL IsFileExist(CString strFilePath);

    CXmlNodePtr CreateNode(CString strName);
    
};